package com.iotechn.unimall.admin.myapi.user;

import com.iotechn.unimall.core.Const;
import com.iotechn.unimall.core.annotation.HttpMethod;
import com.iotechn.unimall.core.annotation.HttpOpenApi;
import com.iotechn.unimall.core.annotation.HttpParam;
import com.iotechn.unimall.core.annotation.HttpParamType;
import com.iotechn.unimall.core.annotation.param.NotNull;
import com.iotechn.unimall.core.annotation.param.TextFormat;
import com.iotechn.unimall.core.exception.ServiceException;
import com.iotechn.unimall.mydata.domain.Student;
import com.iotechn.unimall.mydata.domain.Teacher;
import com.iotechn.unimall.mydata.domain.User;
import com.iotechn.unimall.mydata.dto.IUser;
import com.iotechn.unimall.mydata.dto.UserAndStudentOrTeacher;

@HttpOpenApi(group = "course.user", description = "my用户服务")
public interface IUserService {

    @HttpMethod(description = "发送验证码到邮箱")
    String sendVerifyCode(
            @NotNull @HttpParam(name = "email", type = HttpParamType.COMMON, description = "用户邮箱") String email) throws Exception;

    @HttpMethod(description = "用户注册")
    public User register(
             @NotNull@HttpParam(name = "email", type = HttpParamType.COMMON, description = "邮箱") String email,
             @NotNull@HttpParam(name = "password", type = HttpParamType.COMMON, description = "密码") String password,
             @HttpParam(name = "name", type = HttpParamType.COMMON, description = "姓名") String name,
             @HttpParam(name = "nickname", type = HttpParamType.COMMON, description = "昵称") String nickname,
             @HttpParam(name = "loginType", type = HttpParamType.COMMON, description = "用户类型") String loginType,
             @HttpParam(name = "phone", type = HttpParamType.COMMON, description = "手机号") String phone,
             @HttpParam(name = "sno", type = HttpParamType.COMMON, description = "学生学号") String sno,
             @HttpParam(name = "school", type = HttpParamType.COMMON, description = "学校名称") String school,
             @HttpParam(name = "department", type = HttpParamType.COMMON, description = "系别") String department,
             @HttpParam(name = "major", type = HttpParamType.COMMON, description = "专业") String major,
             @HttpParam(name = "garde", type = HttpParamType.COMMON, description = "年级") String garde,
             @HttpParam(name = "myclass", type = HttpParamType.COMMON, description = "班级") String myclass,
             @HttpParam(name = "degree", type = HttpParamType.COMMON, description = "学历") String degree,
             @HttpParam(name = "tno", type = HttpParamType.COMMON, description = "教师学号") String tno,
            @NotNull @HttpParam(name = "verifyCode", type = HttpParamType.COMMON, description = "注册验证码") String verifyCode) throws ServiceException;


    @HttpMethod(description = "用户重置密码")
    public String resetPassword(
            @NotNull @HttpParam(name = "email", type = HttpParamType.COMMON, description = "用户邮箱") String email,
            @NotNull @TextFormat(lengthMin = 6, lengthMax = 18, notChinese = true) @HttpParam(name = "password", type = HttpParamType.COMMON, description = "用户密码") String password,
            @NotNull @HttpParam(name = "verifyCode", type = HttpParamType.COMMON, description = "注册验证码") String verifyCode) throws ServiceException;

    @HttpMethod(description = "用户登录")
    public IUser login(
            @NotNull @HttpParam(name = "email", type = HttpParamType.COMMON, description = "用户邮箱") String email,
            @NotNull @TextFormat(lengthMin = 6, lengthMax = 18, notChinese = true) @HttpParam(name = "password", type = HttpParamType.COMMON, description = "用户密码") String password) throws ServiceException;

    @HttpMethod(description = "返回用户信息（包括学生教师信息）")
    public UserAndStudentOrTeacher get(
            @NotNull @HttpParam(name = "userId", type = HttpParamType.COMMON, description = "用户id") Long userId) throws ServiceException;


    @HttpMethod(description = "用户注销")
    public String logout(
            @NotNull @HttpParam(name = Const.USER_ACCESS_TOKEN, type = HttpParamType.HEADER, description = "用户访问") String accessToken,
            @NotNull @HttpParam(name = "userId", type = HttpParamType.USER_ID, description = "用户Id") Long userId) throws ServiceException;

}
